<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

class QdController extends Controller
{

    public function maiChe(){
        $number = DB::table('seller_infos')->count();
        return view('home.maiche',['number'=>$number]);
    }

    public function fuwu(){
        return view('home/fuwu');
    }

    public function wenDa(){
        $news = DB::table('carnews')->select('title','xid')->limit(4)->get();
        return view('home/wenda',['news'=>$news]);
    }

    public function fenQi(){
        return view('home/carsfenqi');
    }

    public function appDown(){
        return view('home/appdown');
    }

    public function all($id = 1){
        $gushi = DB::table('carnews')->paginate(4);
        $tuijian = DB::table('carnews')->select('xid','title','img')->orderby('xid','asc')->limit('5')->get();
        return view('home/newsall',['gushi'=>$gushi,'tuijian'=>$tuijian,'id'=>$id]);
    }

    public function knowledge($id = 0){
        $gushi = DB::table('carnews')->orderby('xid','desc')->paginate(4);
        $tuijian = DB::table('carnews')->select('xid','title','img')->orderby('xid','asc')->limit('5')->get();
        return view('home/knowledge',['gushi'=>$gushi,'tuijian'=>$tuijian,'id'=>$id]);

    }

    public function story($id = 0){
        $gushi = DB::table('carnews')->orderby('cate_id','desc')->paginate(4);
        $tuijian = DB::table('carnews')->select('xid','title','img')->orderby('xid','asc')->limit('5')->get();
        return view('home/story',['gushi'=>$gushi,'tuijian'=>$tuijian,'id'=>$id]);

    }

    public function tuijian($id = 0){
        $gushi = DB::table('carnews')->orderby('cate_id','asc')->paginate(4);
        $tuijian = DB::table('carnews')->select('xid','title','img')->orderby('xid','desc')->limit('5')->get();
        return view('home/tuijian',['gushi'=>$gushi,'tuijian'=>$tuijian,'id'=>$id]);

    }



    public function sarTive($xid){
        $news = DB::table('carnews')->where('xid',$xid)->first();
        $tuijian = DB::table('carnews')->select('xid','img','title')->orderby('xid','asc')->limit('4')->get();
        $id = rand(1,4);
        return view('home/carsartive',['news'=>$news,'tuijian'=>$tuijian,'id'=>$id]);
    }

    public function jingXuan(){
        return view('home/footerjingxuan');
    }

    public function keTui(){
        return view('home/ketui');
    }

    public function zhiBao(){
        return view('home/zhibao');
    }

    public function zhiFu(){
        return view('home/zhifu');

    }

    public function guanYu($id=1){
        return view('home/guanyuwomen',['id'=>$id]);
    }

    public function lianXi($id=0){
        return view('home/lianxi',['id'=>$id]);
    }
    public function jiaRu($id=0){
        return view('home/jiaru',['id'=>$id]);
    }

    public function tiWen(){
        $new = DB::table('carnews')->paginate(4);
        $car = DB::table('car_infos')->orderby('cate_id','asc')->limit(3)->get();
        return view('home/tiwen',['new'=>$new,'car'=>$car]);
    }
}
